This is in answer to the numerous users of Blazin' Forth who want a full screen editor, but who have had some trouble getting one up on their systems.
The approach used here requires altering LIST (screen #5), and adding a few lines of code to screen #41. Please note: You must have the source code do make these changes.
The changes to LIST are indicated below. The only changes are the addition of DECIMAL in line 9 , and the addition of 2 .R ." > " in line 11. This will cause the screens to list in the format shown below, with line numbers as 0> instead of just a number.
scr #5
0> ( utilities -- [line] .line list sdbjun85)
1>
2> vocabulary editor
3>
4> : (line) printing? @ if cmdoff then block swap
5> c/l * + c/l printing? @ if #lp (cmdout) drop then ;
6>
7> : .line (line) -trailing type ;
8>
9> : list decimal cr dup scr !
10> ." scr #" u. 16 0
11> do cr i 2 .r ." > " i scr @
12> .line ?terminal ?leave
13> loop cr editor ;
14>
15>
The actual screen editing functions are shown below. You will need to add PL (for Put Line) , SLINE (Screen Line) and the words 0> 1> etc. created by SLINE to this screen. PL simply accepts a line of input from the terminal, and moves it to the insert buffer and to the appropriate spot in the appropriate buffer. SLINE is used to define the numbers displayed by LIST as actual forth words, which call PL with the proper line number.
scr #41
0> ( starting forth editor -- r p sdbmay85)
1>
2> : (r) >line# ibuf 1+ swap >move ;
3>
4> : p 5e text ibuf bufmove (r) ;
5>
6> // following words add fullscreen editing.
7> : pl c/l * r# ! 0 text pad c@ 0= if ibuf 55 blank then
Once you have correctly entered these changes and FLUSHed the buffers, proceed as follows:
FORGET THRU
1 LOAD
This will cause the system to recompile, you will get a few "XXXX already exists" messages. This is normal.
When you get the message "LOCATE ENABLED" the system is recompiled, and the fullscreen editing extensions have been added.
Now do:
DCLOSE
Remove the systems disk, and insert a formatted *program* disk into the drive.
Now type
SAVE-FORTH
you will be prompted for a filename. Give it a unique filename (SAVE-FORTH won't replace any files, unless you are daring, and give it the @0: or @1: prefix.) This will cause the modified forth to be saved to disk.
Using the Editor:
All the old editor commands are still active, in addition, you may now cursor around the screen at will, inserting and deleting as you like. Only two things should be remembered:
1) The line numbers 0> , 1> etc. are now defined as Forth words, and so you must remember to follow each with at least one space. For Example:
0> // this is line 0
not
0>//this is line 0
The character length of each line is still only 64 characters in length. If you type more than that, the line will be truncated. Such is life. You can always LIST the screen (or type the line using XX T ) to check up on things.
I hope this answers the questions on exactly how to do it, and also points out the flexibility and extensibility of Forth. How many other languages let you add fullscreen editing or other features? How many let you do it in less than 15 lines of code?